package com.Lyoto.core.config.handler;

import com.Lyoto.core.enetity.Result;
import com.Lyoto.core.enetity.exception.LimitException;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseStatus;
import org.springframework.web.bind.annotation.RestControllerAdvice;

/**
 * @author Lyoto
 * @Description
 * @Date 2022-09-22 13:58
 * @Version
 **/
@Slf4j
@RestControllerAdvice
public class GlobalExceptionHandler {
    @ExceptionHandler(value = LimitException.class)
    @ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR)
    public Result exceptionHandler(){
        return Result.fail(500,"请求次数达到限流值",null);
    }
}
